import Vue from 'vue'
import App from './App.vue'

import router from './router'
import store from './store'


import 'normalize.css/normalize.css'// A

import '@/assets/css/common.scss'
import '@/assets/css/font.css'

import Modal from '@/components/Modal.vue';

import filters from '@/filters/index.js';

import VueAMap, { lazyAMapApiLoaderInstance } from 'vue-amap'

import VueBus from 'vue-bus';
Vue.use(VueBus);

Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key]);
});


// 调用高德地图Map
Vue.use(VueAMap);

VueAMap.initAMapApiLoader({
  key: 'bade9da5722268a2b9dd1910e07e9844',
  // 插件集合 （插件按需引入）
  plugin: [
    "AMap.Autocomplete", //输入提示插件
    "AMap.PlaceSearch", //POI搜索插件
    "AMap.Scale", //右下角缩略图插件 比例尺
    "AMap.OverView", //地图鹰眼插件
    "AMap.ToolBar", //地图工具条
    "AMap.MapType", //类别切换控件，实现默认图层与卫星图、实施交通图层之间切换的控制
    "AMap.PolyEditor", //编辑 折线多，边形
    "AMap.CircleEditor", //圆形编辑器插件
    "AMap.Geolocation",//定位控件，用来获取和展示用户主机所在的经纬度位置
    "AMap.MarkerClusterer"
  ],
  // ,'AMap.Autocomplete', 'AMap.Geolocation', 'AMap.PlaceSearch', , 'AMap.MapType', 'AMap.OverlayGroup',
  // plugin: ['AMap.PolyEditor', 'AMap.CircleEditor', 'AMap.Geocoder', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.CustomLayer', 'AMap.MarkerClusterer'],
  v: '1.4.15',
  uiVersion: '1.0.11'
})

lazyAMapApiLoaderInstance.load().then(() => {
  const script = document.createElement('script')
  script.type = 'text/javascript'
  // script.async = true;
  // script.defer = true;
  script.src = 'https://webapi.amap.com/maps?key=bade9da5722268a2b9dd1910e07e9844&v=1.4.15'
  document.body.appendChild(script)
})

window._AMapSecurityConfig = {
  securityJsCode: '3ab5c7dd3eadbcf355602fc4c3cc2584',
}


Vue.prototype.$store = store;
Vue.config.productionTip = false

Vue.component('modal', Modal)

new Vue({
  store,
  router,
  render: h => h(App),
}).$mount('#app')
